package Day13;

import java.io.*;

/**
 * @Author kalista
 * @Description
 * @Date 2020/11/19  10:20
 **/
public class Test01 {
    public static void main(String[] args) {
        FileInputStream fileInputStream = null;
        FileOutputStream fileOutputStream = null;
        //file 文件   输入  input   流 stream
        try {

            File file = new File("f:\\b.txt");
            // 如果这个文件不存在
            if (!file.exists()){
                // 创建文件
                file.createNewFile();
            }

            fileInputStream = new FileInputStream("f:\\a.txt");
            fileOutputStream = new FileOutputStream(file);
            int temp = 0;
            while ((temp = fileInputStream.read()) != -1) {
                fileOutputStream.write(temp);
            }






//            // 一个字节一个字节读
//            int a = fileInputStream.read();// 打印是不是 遵循了Ascii
//            int b = fileInputStream.read();
//            int c = fileInputStream.read();
//
//            System.out.println((char)a);
//            System.out.println((char)b);
//            System.out.println((char)c);
//
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileInputStream.close();
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
